package tn.talan.jxls;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;

import tn.talan.data.entities.Employee;

import net.sf.jxls.exception.ParsePropertyException;
import net.sf.jxls.transformer.XLSTransformer;

public class GenrateXLS {
	
	public boolean generatereport(String templatename,String destname,Map data) {
	    try {
		
        XLSTransformer transformer = new XLSTransformer();
        //transformer.markAsFixedSizeCollection("employee");
    
			transformer.transformXLS("src/main/resources/template/"+templatename+".xls", data, "src/main/resources/files/"+destname+".xls");
			return true;
		} catch (ParsePropertyException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		} catch (InvalidFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return false;
		}
	}
	
	
	
}
